<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <title>012-骨架屏加载动画</title>
    <style>
      .max {
        padding: 20px;
      }

      .box1,
      .box2 {
        width: 100%;
        height: 40px;
        border-radius: 2px;
        background-color: #ededed;
      }

      .box2 {
        height: 80px;
        margin-top: 20px;
      }

      .loading div {
        background-color: #ededed;
        background: linear-gradient(
            100deg,
            rgba(255, 255, 255, 0) 40%,
            rgba(255, 255, 255, 0.5) 50%,
            rgba(255, 255, 255, 0) 60%
          )
          #ededed;
        background-size: 200% 100%;
        background-position-x: 180%;
        animation: 1.5s loading ease-in-out infinite;
      }

      @keyframes loading {
        to {
          background-position-x: -20%;
        }
      }
    </style>
  </head>

  <body>
    <div class="max loading">
      <div class="box1"></div>
      <div class="box2"></div>
    </div>
  </body>
</html>
